package com.itheima.demo.demo12;


import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

public class LamaZH {
    public static void main(String[] args) {
method(()->{
    return "孙悟空，500";
},(s)->{
    String[] split = s.split("，");
    String ss = split[1];

    int i = Integer.parseInt(ss);
    return i;
},(i)->{
    if(i>12){
        return true;
    }else {
        return false;}
},(i)->{
    System.out.println(i+10);
});

    }
    public static void method(Supplier<String> supplier, Function<String, Integer> func,
                              Predicate<Integer> pre, Consumer<Integer> consumer) {
        String data = supplier.get();
        Integer inte = func.apply(data);
        boolean flag = pre.test(inte);

        if (flag) {
            consumer.accept(inte);
        } else {
            System.out.println("不用lambda表达式处理数据");
        }
    }

}
